package com.sjzsqjy.asdtiang.mysql;

import java.sql.Timestamp;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;

import com.sjzsqjy.asdtiang.action.ObjectAction;

/**
 * FeedBack entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "feed_back", catalog = "hospital")
public class FeedBack implements java.io.Serializable {

	// Fields

	private String id;
	private Long version;
	private String manageDoctor;
	private String unitName;
	private String reply;
	private String back3;
	private String back2;
	private String back1;
	private String contact;
	private Timestamp lastUpdated;
	private Timestamp dateCreated;

	// Constructors

	/** default constructor */
	public FeedBack() {
	}

	/** minimal constructor */
	public FeedBack(Long version, String manageDoctor, String unitName,
			String back3, String back2, String back1) {
		this.version = version;
		this.manageDoctor = manageDoctor;
		this.unitName = unitName;
		this.back3 = back3;
		this.back2 = back2;
		this.back1 = back1;
	}

	/** full constructor */
	public FeedBack(Long version, String manageDoctor, String unitName,
			String reply, String back3, String back2, String back1,
			String contact, Timestamp lastUpdated, Timestamp dateCreated) {
		this.version = version;
		this.manageDoctor = manageDoctor;
		this.unitName = unitName;
		this.reply = reply;
		this.back3 = back3;
		this.back2 = back2;
		this.back1 = back1;
		this.contact = contact;
		this.lastUpdated = lastUpdated;
		this.dateCreated = dateCreated;
	}

	// Property accessors
	@Id
	@GeneratedValue(generator = "system-uuid")   
	@GenericGenerator(name = "system-uuid", strategy = "uuid.hex")  
	@Column(name = "id", unique = true, nullable = false)
	public String getId() {
		return this.id;
	}

	public void setId(String id) {
		this.id = id;
	}

	@Column(name = "version", nullable = false)
	public Long getVersion() {
		return this.version;
	}

	public void setVersion(Long version) {
		this.version = version;
	}

	@Column(name = "manage_doctor", nullable = false)
	public String getManageDoctor() {
		return this.manageDoctor;
	}

	public void setManageDoctor(String manageDoctor) {
		this.manageDoctor = manageDoctor;
	}

	@Column(name = "unit_name", nullable = false)
	public String getUnitName() {
		return this.unitName;
	}

	public void setUnitName(String unitName) {
		this.unitName = unitName;
	}

	@Column(name = "reply")
	public String getReply() {
		return this.reply;
	}

	public void setReply(String reply) {
		this.reply = reply;
	}

	@Column(name = "back3", nullable = false)
	public String getBack3() {
		return this.back3;
	}

	public void setBack3(String back3) {
		this.back3 = back3;
	}

	@Column(name = "back2", nullable = false)
	public String getBack2() {
		return this.back2;
	}

	public void setBack2(String back2) {
		this.back2 = back2;
	}

	@Column(name = "back1", nullable = false)
	public String getBack1() {
		return this.back1;
	}

	public void setBack1(String back1) {
		this.back1 = back1;
	}

	@Column(name = "contact")
	public String getContact() {
		return this.contact;
	}

	public void setContact(String contact) {
		this.contact = contact;
	}

	@Column(name = "last_updated", length = 19)
	public Timestamp getLastUpdated() {
		return this.lastUpdated;
	}

	public void setLastUpdated(Timestamp lastUpdated) {
		this.lastUpdated = lastUpdated;
	}

	@Column(name = "date_created", length = 19)
	public Timestamp getDateCreated() {
		return this.dateCreated;
	}

	public void setDateCreated(Timestamp dateCreated) {
		this.dateCreated = dateCreated;
	}
	public static FeedBack validate(FeedBack object,ObjectAction action){
		if(null==object.getBack1()||object.getBack1().equals("")){
			return null;
		}
		if(null==object.getBack2()||object.getBack2().equals("")){
			return null;
		}
		if(null==object.getBack3()||object.getBack3().equals("")){
			return null;
		}
		if(null==object.getContact()||object.getContact().equals("")){
			return null;
		}
		if(null==object.getManageDoctor()||object.getManageDoctor().equals("")){
			return null;
		}
		if(null==object.getUnitName()||object.getUnitName().equals("")){
			return null;
		}
		object.setDateCreated(new Timestamp((new Date()).getTime()));
		object.setLastUpdated(new Timestamp((new Date()).getTime()));
		object.setVersion(1l);
		return object;
	}

}